package snmptest.gateway;

import com.isnmp.common.snmp.SNMPAPI;
import com.isnmp.common.snmp.SNMPFactory;
import com.isnmp.common.snmp.SNMPTarget;
import com.isnmp.common.snmp.mib.MibSystem;

public class ThreadTest extends Thread {
    public static long num = 0L;
    public static long err = 0L;

    public static void main(String[] argsp) {
        try {
            SNMPFactory.init(1, null, 8088);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        new ThreadTest().start();
        new ThreadTest().start();
        new ThreadTest().start();
        new ThreadTest().start();
        new ThreadTest().start();
        new ThreadTest().start();
    }

    public void run() {
        SNMPTarget target127 = new SNMPTarget();
        SNMPTarget target166 = new SNMPTarget();
        target166.port = 166;
        SNMPTarget notarget = new SNMPTarget();
        notarget.nodeIP = "192.168.2.199";
        MibSystem mibsys = new MibSystem();
        while (true) {
            try {
                SNMPAPI snmpapi = SNMPFactory.getSNMPAPI();
                try {
                    num += 1L;
                    MibSystem newsys = (MibSystem) snmpapi.getMibObject(mibsys, target127);
                    if (newsys.getSysServices() != 76) {
                        err += 1L;
                    }
                } catch (Exception ex) {
                    err += 1L;
                }
                try {
                    num += 1L;
                    MibSystem newsys = (MibSystem) snmpapi.getMibObject(mibsys, target166);
                    if (newsys.getSysServices() != 99) {
                        err += 1L;
                    }
                } catch (Exception ex) {
                    err += 1L;
                }
                try {
                    num += 1L;
                    MibSystem newsys = (MibSystem) snmpapi.getMibObject(mibsys, notarget);
                    err += 1L;
                } catch (Exception localException1) {
                }
                System.out.println("process:" + num + "   err:" + err);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}